#include "apue.h"
#include <errno.h>
#include <fcntl.h>

void file_creat_test(const char *filename);

int main(int argc, char const *argv[])
{
    /* code */
    if (argc != 2)
		err_quit("usage: a.out <filename#>");
    file_creat_test(argv[1]);
    exit(0);
}

void file_creat_test(const char *filename)
{
    errno = 0;
    int fd = creat(filename, 0777);
    if (errno)
        err_msg("create file");
    if(fd < 0) {
        
    } else {
        printf("create file succeed! fd:%d\n", fd);
        close(fd);
    }
    
}
